<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('收件详情')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <i class="fa fa-info-circle"></i> 通知详情
                </div>
                <div class="panel-body">
                    <form class="form-horizontal m-t" id="signupForm">
                        <!--主题时间类型发件人署名-->
                        <div class="form-group">
                            <label class="col-sm-3 control-label">主题 ：</label>
                            <div class="form-control-static" th:text="${notice.noticeTheme}">
                            </div>
                            <label class="col-sm-3 control-label">发送时间：</label>
                            <div class="form-control-static"
                                 th:text="${#dates.format(notice.noticeSendingTime,'yyyy-MM-dd HH:mm')}">
                            </div>
                            <label class="col-sm-3 control-label">通知类型：</label>
                            <div class="form-control-static"
                                 th:text="${@dict.getValueByTableAndKey('sys_notice_type',notice.noticeType)}">
                            </div>
                            <label class="col-sm-3 control-label">发件人 ：</label>
                            <div class="form-control-static"
                                 th:text="${@dingUser.getNoticeSenderValue(notice.noticeSender)}">
                            </div>
                            <label class="col-sm-3 control-label">署名 ：</label>
                            <div class="form-control-static" th:text="${notice.noticeSignature}">
                            </div>
                            <!--<label class="col-sm-3 control-label">内容 ： </label>
                            <div class="form-control-static" th:text="${notice.noticeContent}">
                            </div>-->
                        </div>
                        <!--附件-->
                        <div class="form-group" id="down-button">
                            <label class="col-sm-3 control-label">附件
                                <a href="javascript:void(0)" onclick="downloadThis()">
                                    <i class="fa fa-mouse-pointer"></i>下载
                                </a>
                            </label>
                            <div class="form-control-static" th:text="${file.fileName}"></div>
                        </div>
                        <!--会议报名-->
                        <div class="form-group" id="sign-button">
                            <label class="col-sm-3 control-label">参会人员：</label>
                            <div class="form-control-static" id="sign-yes">
                                <a class="btn btn-success btn-xs inline" href="javascript:void(0)" onclick="signUp()"><i></i> 会议报名</a>
                            </div>
                            <div class="form-control-static" id="sign-edit">
                                <i class="form-control-static" style="font-style:normal"
                                   th:text="${addressee.participantsName}">
                                </i>
                                <a class="btn btn-danger btn-xs inline" href="javascript:void(0)" onclick="signUp()"><i></i> 修改</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <i class="fa fa-info-circle"></i> 以下为通知回复
                </div>
                <div th:each="response : ${response}" class="panel-body">
                    <form class="form-horizontal m-t">
                        <!--时间内容-->
                        <div class="form-group">
                            <label class="col-sm-3 control-label">回复时间：</label>
                            <div class="form-control-static"
                                 th:text="${#dates.format(response.responseTime,'yyyy-MM-dd HH:mm')}">
                            </div>
                            <!--<label class="col-sm-3 control-label">回复人 ：</label>
                            <div class="form-control-static" th:text="${@dingUser.getAddresseeNameValue(response.responseSender)}">
                            </div>-->
                            <label class="col-sm-3 control-label">回复内容：</label>
                            <div class="form-control-static" style="margin-right: 45px;margin-left: 45px"
                                 th:text="${response.responseContent}">
                            </div>
                        </div>
                        <!--附件-->
                        <div class="form-group">
                            <label class="col-sm-3 control-label">附件
                                <a href="javascript:void(0)" th:onclick="downloadThat([[${response.fileRoute}]]);">
                                    <i class="fa fa-mouse-pointer"></i>下载
                                </a>
                            </label>
                            <div class="form-control-static" th:text="${response.fileName}"></div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var fileRoute = [[${file.fileRoute}]];
    var noticeType = [[${notice.noticeType}]];
    var signId = [[${addressee.addresseeId}]];
    var partName = [[${addressee.participantsName}]];
    var prefix = ctx + "sys/common/download";
    var signUrl = ctx + "education/notice/signUp/";
    window.onload = function () {
        if (!fileRoute) {
            document.getElementById("down-button").style.display = "none";
        }//判断有无附件，选择是否显示
        if (noticeType === "2") {
            document.getElementById("sign-button").style.visibility = "visible";
        }else {
            document.getElementById("sign-button").style.display = "none";
        }//判断是否会议通知，选择是否显示
        if(!partName){
            document.getElementById("sign-yes").style.visibility = "visible";
            document.getElementById("sign-edit").style.display = "none";
        }else {
            document.getElementById("sign-edit").style.visibility = "visible";
            document.getElementById("sign-yes").style.display = "none";
        }//判断有无参会姓名，选择显示报名/修改
    };

    function downloadThis() {
        down_url = prefix + "/" + fileRoute;
        window.open(down_url);
    }

    function downloadThat(file) {
        down_url = prefix + "/" + file;
        window.open(down_url);
    }

    function signUp() {
        var options = {
            title: "会议报名窗口",
            width: 600 ,
            height: ($(window).height() - 200) ,
            url: signUrl + signId,
            skin: 'layui-layer-gray',
            btn:['确定', '关闭'],
            yes: function(index, layero) {
                var iframeWin = layero.find('iframe')[0];
                iframeWin.contentWindow.submitHandler(index, layero);
            },
            cancel: function(index) {
                layer.close(index);
            }
        };
        $.modal.openOptions(options);
    }
</script>
</body>
</html>
